import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { global as globalDuck, auth0 as authDuck } from 'ducks'
import { Grid } from 'semantic-ui-react'
import PublicHome from './home'
import Lock from './auth0'

class signinView extends Component {
  componentDidMount() {
    const { actionShow } = this.props
    actionShow(Lock)
  }

  render() {
    return (
      <PublicHome>
        <Grid textAlign="center" style={{ height: '100%' }} verticalAlign="middle">
          <Grid.Column style={{ maxWidth: 450 }} id="loginform" />
        </Grid>
      </PublicHome>
    )
  }
}

signinView.propTypes = {
  actionSignIn: PropTypes.func.isRequired,
}

const mapDispatchToProps = {
  actionSignIn: globalDuck.creators.actionSignIn,
  actionReciveUser: globalDuck.creators.actionReciveUser,
  actionShow: authDuck.creators.actionShow,
}

export default connect(
  null,
  mapDispatchToProps,
)(signinView)
